@extends('admin.public')

@section('content')
    <div class="col-md-12">
        <form data-validate="parsley" method="post">
            {{ csrf_field() }}
            <section class="panel panel-default">
                <header class="panel-heading">
                    {{ $frame['title'] }}
                    <a href="{{ route('admin.user.index') }}" class="pull-right btn btn-xs btn-default">用户列表</a>
                </header>
                <div class="panel-body">
                    <p class="text-muted">编辑用户信息时,请勿随意修改用户的重要资料信息!</p>
                    <div class="form-group pull-in clearfix">
                        <div class="col-sm-6">
                            <label>用户账号</label>
                            <input type="text" class="form-control parsley-validated" placeholder="用户账号" name="name"
                                   data-required="true" value="{{ $user->name }}">
                        </div>
                        <div class="col-sm-6">
                            <label>电子邮箱</label>
                            <input type="email" class="form-control parsley-validated" placeholder="电子邮箱" name="email"
                                   data-required="true" value="{{ $user->email }}">
                        </div>
                    </div>
                    <div class="form-group pull-in clearfix">
                        <div class="col-sm-6">
                            <label>联系手机</label>
                            <input type="text" data-type="phone" data-required="true"
                                   class="form-control parsley-validated"
                                   name="phone"
                                   placeholder="联系电话" value="{{ $user->phone }}">
                        </div>
                        <div class="col-sm-6">
                            <label>会员等级</label>
                            <select data-required="true" class="form-control parsley-validated" name="level">
                                @if(!empty($levels))
                                    @foreach($levels as $key=>$value)
                                        <option {{ $key==$user->level?'selected':'' }} value="{{ $key }}">{{ $value }}</option>
                                    @endforeach
                                @endif
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label>账号描述</label>
                        <textarea class="form-control parsley-validated" rows="6" data-required="true"
                                  name="describe"
                                  placeholder="账号描述">{{ $user->describe }}</textarea>
                    </div>
                    <div class="checkbox i-checks">
                        <label>
                            <input type="checkbox" name="status" {{ $user->status==1?'checked':'' }}
                            class="parsley-validated"><i></i> 点击此项,即开启用户
                        </label>
                    </div>
                </div>
                <footer class="panel-footer text-right bg-light lter">
                    <button type="submit" class="btn btn-success btn-s-xs">保存</button>
                </footer>
            </section>
        </form>
    </div>
@endsection

@section('css')
@endsection

@section('js')
    <!-- parsley -->
    <script src="/public/theme/js/parsley/parsley.min.js"></script>
    <script src="/public/theme/js/parsley/parsley.extend.js"></script>
@endsection